<%@page import="auxilary.Links"%>
<%@page import="auxilary.Actions"%>
<%@page import="entities.User"%>
<%@ page language="java" contentType="text/html; charset=windows-1255"
    pageEncoding="windows-1255"%>
<%
	User user = (User) request.getSession().getAttribute("user");	
	boolean loggedIn = (user != null);
	String username = loggedIn?user.getUsername():"Guest";
	String guest = loggedIn?"":" guest";
%>
	<%=Links.Scripts.FRAME %>
</head>
<body>
	<div class="frame">
		<div id="header">
			<div class="logo-img" onclick="window.location.href='<%=Links.PROJECT_BASE %>'"></div>
			<div id="header-button-1" class="box" onclick="window.location.href='<%=Links.PROJECT_BASE %>'">Home</div>
		   <% if (loggedIn) { %>
			<div id="header-button-2" class="box" onclick="window.location.href='<%=Links.Pages.SCHEDULE %>'">My Schedule</div>
			<div id="header-button-3" class="box" onclick="window.location.href='<%=Links.Pages.USER_COURSES %>'">My Courses</div>
			<div id="header-button-4" class="box" onclick="window.location.href='<%=Links.Pages.WISHLIST %>'">My Wishlist</div>
		   <% } %>
			<div id="header-button-5" class="box last" onclick="window.location.href='<%=Links.Pages.SEARCH %>'">Find Courses</div>
		   	<div id="header-button-6" class="box<%=guest %> user logout">
		   		<% if (loggedIn) { %>
		   			<a href="<%=Links.PROJECT_BASE %>Users/Profile"><%=username %></a>
		   		<% } else { %>
		   			<%=username %>
		   		<% } %>
		   			<img src="<%=Links.PROJECT_BASE %>images/arrow.png" onclick="togglePopout()" alt="" />
		   		<div class="user-popout">
		   		   <% if (loggedIn) { %>
					<a href="<%=Links.Pages.PROFILE %>">My Profile</a>
					<a href="<%=Links.Pages.USER_COURSES %>">My Courses</a>
					<a href="<%=Links.Pages.WISHLIST %>">My Wishlist</a>
					<hr />
					<a href="javascript:deleteUser(<%=Actions.User.DELETE %>);">Delete my account</a>
					<hr />
					<a href="javascript:logout(<%=Actions.User.LOGOUT %>)">Logout</a>
				  <% } else { %>
				  	Login:
				  	<form action="javascript:login('login-anywhere')" class="login-anywhere">
						<input type="text" name="username" placeholder="username" />
						<input type="password" name="password" placeholder="password" />
						<input type="hidden" name="action" value="<%=Actions.User.LOGIN %>" />
						<center><div id="login-anywhere-error" class="error"></div></center>
						<input type="submit" value="Login" />
					</form>
				   <% } %>
				</div>
		   	</div>
		</div>
		<input type="hidden" id="project-base" value="<%=Links.PROJECT_BASE %>" />
		<div class="content">